package com.zjw.nanyinge.controller;

import com.zjw.nanyinge.service.OpenAIChatService;
import com.zjw.nanyinge.vo.req.ChatVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Slf4j
@RestController
@RequestMapping("/openAI")
public class OpenAIChatController {

    @Resource
    private OpenAIChatService openAIChatService;

    @PostMapping("/createCompletion")
    public String createCompletion(@RequestBody ChatVO chatVO) {
        return openAIChatService.createChatCompletion(chatVO.getText());
    }
}
